//
//  HD_NKM_MapView.h
//  HDWuDaDaoServiceCenter
//
//  Created by HDNiuKuiming on 2017/5/16.
//  Copyright © 2017年 HDNiuKuiming. All rights reserved.
//
/*
 版本：V1.0
 开发者：NKM
 更新时间：2017-05-15
 功能描述：瓦片地图加载，基于本地的瓦片和基于网络实时加载瓦片地图
 （1）contentSize的计算，等于地图的宽高除以8；
 （2）zoomScale默认等于minimumZoomScale，一般是以屏幕的宽自适应；
 （3）levelsOfZoom = levelsOfDetail；maximumZoomScale = 2的levelsOfZoom次方；
 （4）在线加载瓦片必须初始化的四个元素，在分类中使用；
 
 */
/*
 
 */

#import <UIKit/UIKit.h>
#import "HDAnnotation.h"
#import "HDCallOutView.h"


@class HDTiledView,HD_NKM_MapView;

@protocol HD_NKM_MapViewDataSource <NSObject>

// 绘制瓦片的代理方法
- (UIImage *)mapView:(HD_NKM_MapView *)mapView
         imageForRow:(NSInteger)row
              column:(NSInteger)column
               scale:(NSInteger)scale;
@end

@protocol HD_NKM_MapViewDelegate <NSObject>

@optional
- (void)mapViewDidZoom:(HD_NKM_MapView *)mapView;
- (void)mapViewDidScroll:(HD_NKM_MapView *)mapView;
- (void)mapView:(HD_NKM_MapView *)mapView didReceiveSingleTap:(UIGestureRecognizer *)gestureRecognizer;
- (void)mapView:(HD_NKM_MapView *)mapView didReceiveDoubleTap:(UIGestureRecognizer *)gestureRecognizer;
- (void)mapView:(HD_NKM_MapView *)mapView didReceiveTwoFingerTap:(UIGestureRecognizer *)gestureRecognizer;

@end




@interface HD_NKM_MapView : UIScrollView<UIScrollViewDelegate>
{
@private
    NSMutableArray *_pinAnnotations;
    HDCallOutView  *_callout;
    UIView         *routeView;   // 透明的路线层
    
@public
    
}

@property (nonatomic, assign) id<HD_NKM_MapViewDataSource> dataSource;
@property (nonatomic, assign) id<HD_NKM_MapViewDelegate> mapViewdelegate;
@property (nonatomic, assign) BOOL           centerSingleTap;
@property (nonatomic, assign) BOOL           zoomsInOnDoubleTap;
@property (nonatomic, assign) BOOL           zoomsOutOnTwoFingerTap;
@property (nonatomic, assign) BOOL           isSuccessiveLocation;
@property (nonatomic, assign) BOOL           isShowCallOutView; // 点击POI后是否显示callout，默认不显示

@property (nonatomic, assign) CGSize         orignalSize;
@property (nonatomic, assign) size_t         levelsOfZoom;
@property (nonatomic, assign) size_t         levelsOfDetail;
@property (nonatomic, strong) NSMutableArray *pinAnnotations;
@property (nonatomic, strong) HDCallOutView  *callout;     // 点击气泡弹出视图变大

@property (nonatomic, strong) NSMutableSet     *mapItemSet;         // 在线加载，需要下载的瓦片地图名称容器
@property (nonatomic, strong) NSOperationQueue *downloadItemQueue;  // 在线加载，下载队列
@property (nonatomic, strong) NSString         *urlPrefix;          // 在线加载，下载URL前缀
@property (nonatomic, strong) NSString         *floorStr;           // 在线加载，地图的编号，
@property (nonatomic, strong) NSString         *mapItemPath;        // 在线加载，瓦片的存储路径，不包括瓦片的名称



#pragma mark
#pragma mark -------- Methods --------


+ (Class)tiledLayerClass;
- (instancetype)initWithFrame:(CGRect)frame contentSize:(CGSize)contentSize;
- (void)setContentCenter:(CGPoint)center animated:(BOOL)animated;
- (void)addAnnotation:(HDAnnotation *)annotation animated:(BOOL)animate; // 地图上添加单个POI
- (void)addAnnotations:(NSArray *)annotations animated:(BOOL)animate;    // 地图上添加一组POI
- (void)removeAllAnnatations:(BOOL)animate;

- (void)hideCallOut;
- (IBAction)showCallOut:(id)sender;


- (void)moveToPlayerCenter:(NSString *)identifier; // 地图中心移动到当前播放点的，或者当前位置
- (void)changePOIImg:(NSString *)identifier
            withPath:(NSString *)imagePath;        // 更换POI图片，收号变红，或者已读未读的状态改变

- (void)initRouteImage:(NSString *)imagePath;      // 初始化一个游览路线出来
- (void)initMinMapImage:(NSString *)imagePath;     // 尺寸最小的整个瓦片的图
- (void)showOrHideRouteView:(BOOL)isHide;
- (void)changeMorePin:(NSInteger)number;           // 多个点变大的情况
- (void)myRouteImage:(UIView *)roteView;           // 用于路线导航

- (void)cancelZoomAction; // 取消动画
- (void)cleanBeaconAnimate;
- (void)smallAllAnnView;
- (void)bigAnnotationView:(NSString *)identifier;
- (void)reloadViewAction; // 下载地图完成以后，强制刷新

- (void)enlargeZoom;//放大
- (void)narrowZoom; //缩小

// 定位到当前位置
- (void)removeSuccessive:(HDAnnotation *)ann;
- (void)addSuccsiveAnnotation:(HDAnnotation *)annotation animated:(BOOL)animate;
- (void)centeredSuccessiveLocation:(CGPoint)centerPoint;

// 通过蓝牙号放大图片
- (void)bigAnnByBeaconNum:(NSNumber *)beaconMinor;

- (void)jumpAnimationAnnotationView:(NSString *)identifier;

@end









